package com.furb.topicos;

import com.bancoDados.DataBaseHelper;
import com.furb.topicos.R;

import android.app.Activity;
import android.content.ContentValues;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class dataEspecial extends Activity {

	private EditText ed_pessoa;
	private EditText ed_descricao;
	private EditText ed_data;
	private Button btnCadastra;
	private DataBaseHelper helper;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.data_especial);

		ed_pessoa = (EditText) findViewById(R.id.ed_data_especial_pessoa);
		ed_descricao = (EditText) findViewById(R.id.ed_data_especial_descricao);
		ed_data = (EditText) findViewById(R.id.ed_data_especial_data);
		btnCadastra = (Button) findViewById(R.id.btn_data_especial_cadastra);
		
		helper = new DataBaseHelper(dataEspecial.this);
		
		
		btnCadastra.setOnClickListener(new OnClickListener() {
			
			public void onClick(View v) {
				SQLiteDatabase db = helper.getWritableDatabase();
				ContentValues values = new ContentValues();
				values.put("assunto", "");
				values.put("descricao", ed_descricao.getText().toString());
				values.put("local", "");
				values.put("pessoa", ed_pessoa.getText().toString());
				values.put("data", ed_data.getText().toString());
				values.put("foto", "");
				db.insert("tLembrete", null, values);
				Toast.makeText(dataEspecial.this, "Data Especial cadastrado com sucesso!", Toast.LENGTH_SHORT).show();
				
				finish();
			}
		});
	}
}

